package jinyilw.swing.rlaf.ui;

import jinyilw.swing.FontTools;
import jinyilw.swing.rlaf.theme.RThemeColor;

import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTreeUI;
import javax.swing.tree.TreeCellRenderer;
import java.awt.Color;
import java.awt.Graphics;

/**
 * @author Jinyi
 */
public class RTreeUI extends BasicTreeUI
{

	public static ComponentUI createUI(JComponent c)
	{
		return new RTreeUI();
	}

	@Override
	public void installUI(JComponent c)
	{
		super.installUI(c);
		c.setFont(FontTools.defaultFont);
		c.setOpaque(false);
	}

	@Override
	public void update(Graphics g, JComponent c)
	{
		paint(g, c);
	}

	@Override
	protected Color getHashColor()
	{
		return RThemeColor.colorSet.borderColor;
	}

	@Override
	protected TreeCellRenderer createDefaultCellRenderer()
	{
		return new RTreeCellRenderer();
	}
}
